package com.buba.springboot.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.buba.springboot.dao.userMapper;
import com.buba.springboot.pojo.user;
import com.buba.springboot.pojo.vo.pageVo;
import com.buba.springboot.service.userService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;


@Service
public class userServiceImpl extends ServiceImpl<userMapper,user> implements userService {
    @Autowired
    private userMapper UserMapper;


    @Override
    public PageInfo<user> findall(pageVo limit) {
        PageHelper.startPage(limit.getPageNum(),limit.getPageSize());
        List<user> list=UserMapper.findall(limit.getUsername());
        PageInfo<user> p=new PageInfo<>(list);
        System.out.println("==="+p);
        return p;
    }

    @Override
    public Integer deleteUser(Integer id) {
        return UserMapper.deleteUser(id);
    }

    @Override
    public void dels(List<Integer> id) {
        List<Integer> list=new ArrayList<>();
        for(Integer tmp:list){
            System.out.println(tmp);
        }
            UserMapper.dels(id);

    }

    @Override
    public void updateUser(user form) {
       UserMapper.updateUser(form);
    }


}
